package com.hooya.fa.eu.biz.dao.wrapper;

import com.hooya.fa.eu.api.enums.PlInvoiceTypeEnum;
import com.hooya.fa.eu.biz.dao.entity.PlInvoice;
import com.hooya.integrated.common.mybatis.config.AbstractLambdaQueryWrapperProcess;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @Description
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2023/05
 * @Version 1.0.0
 */
@Data(staticConstructor = "newQuery")
@EqualsAndHashCode(callSuper = true)
public class PlInvoiceWrapper extends AbstractLambdaQueryWrapperProcess<PlInvoice> {

    public PlInvoiceWrapper eqSyncStatus(int status) {
        return (PlInvoiceWrapper) this.eq(PlInvoice::getSyncStatus, status);
    }

    public PlInvoiceWrapper neCorrection() {
        return (PlInvoiceWrapper) this.ne(PlInvoice::getInvoiceType, PlInvoiceTypeEnum.CORRECTION.getValue());
    }

    public PlInvoiceWrapper eqCorrection() {
        return (PlInvoiceWrapper) this.eq(PlInvoice::getInvoiceType, PlInvoiceTypeEnum.CORRECTION.getValue());
    }

    public PlInvoiceWrapper geSellDate(String date) {
        return (PlInvoiceWrapper) this.ge(PlInvoice::getSellDate, date);
    }

    public PlInvoiceWrapper ltSellDate(String date) {
        return (PlInvoiceWrapper) this.lt(PlInvoice::getSellDate, date);
    }

    public PlInvoiceWrapper inInvoiceNumber(List<String> originInvoiceNumberList) {
        return (PlInvoiceWrapper) this.in(!CollectionUtils.isEmpty(originInvoiceNumberList),
                PlInvoice::getInvoiceNumber, originInvoiceNumberList);
    }
}
